package com.firexxx.study.designmodel.sixconcept.openclose.factory;

public class OperationFactory {

    public static IOperation getInstance(String op) {
        switch (op) {
            case "+":
                return new Addition();
            case "-":
                return new Subtraction();
            //新需求到来添加的代码
            case "*":
                return new Multiplication();
            default:
                break;
        }

        throw new IllegalArgumentException();
    }

}
